<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>我的办件</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/app.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.mui-bar~.mui-content .mui-fullscreen {
				top: 44px;
				height: auto;
			}
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: 40px;
				height: 40px;
				border-radius: 100%;
				z-index: 1;
			}
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			.mui-pull-top-wrapper {
				width: 42px;
				height: 42px;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			.mui-pull-top-tips .mui-pull-loading {
				/*-webkit-backface-visibility: hidden;
				-webkit-transition-duration: 400ms;
				transition-duration: 400ms;*/
				
				margin: 0;
			}
			.mui-pull-top-wrapper .mui-icon,
			.mui-pull-top-wrapper .mui-spinner {
				margin-top: 7px;
			}
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height: 40px;
				color: #777;
			}
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: 40px;
				height: 40px;
				margin: 0 auto;
			}
			.mui-pull-top-canvas canvas {
				width: 40px;
			}
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
			/*头部*/
			.mui-title .arr{width:.2rem;height:.2rem;display:block;background:url(../../images/work/arrow_gray01.png) no-repeat;position:absolute;bottom:.3rem;right:1.8rem;}
			/*菜单*/
			.mui-bar-nav~.mui-content{padding:0;margin-top:.9rem;}
			.mui-segmented-control{background:#fff;border:none;border-bottom:1px solid #e1e0e0;}
			.mui-segmented-control.mui-scroll-wrapper .mui-scroll,.mui-segmented-control.mui-scroll-wrapper{height:.95rem;}
			.mui-segmented-control .mui-control-item{overflow:inherit;width:2.55rem;border-right:1px solid #e1e0e0;height:.95rem;line-height:.95rem;font-size:.28rem;color:#444;position:relative;padding:0;margin-left:-.082rem;
			border-left:0;}
			.mui-segmented-control .mui-control-item:last-child{border-right:none;}
			.mui-control-item>.arrow{width:.2rem;height:.2rem;display:block;background:url(../../images/work/arrow_gray.png) no-repeat;position:absolute;bottom:.3rem;right:.16rem;}
			.mui-control-item.mui-active>.arrow{background:url(../../images/work/arrow_blue.png) no-repeat;}
			.mui-segmented-control .mui-control-item.mui-active{color:#1653fc;background:#fff;}
			.mui-control-item>.choose{width:.28rem;height:.33rem;display:block;background:url(../../images/work/icon-sxss-@2x.png) no-repeat;background-size:100% 100%;position:absolute;bottom:.31rem;right:.5rem;}
			.mui-control-item.mui-active>.choose{background:url(../../images/work/icon-sxss-@2x01.png) no-repeat;background-size:100% 100%;}
			/*.mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active .suggest_box{display:block;}			*/
			/*诉求类型下拉*/
			.suggest_box{display:none;position:absolute;top:.97rem;left:0;width:7.8rem;background:rgba(0,0,0,0.3);z-index:3;height:14rem;}
			.suggest_list{position:absolute;top:0;left:0;width:7.5rem;background:#fff;padding:.1rem 0 .3rem 0;z-index:2;}
			.suggest_list>ul{padding:0;margin:0;width:100%;float:left;}
			.suggest_list>ul>li{width:7rem;text-align:left;float:right;height:.8rem;line-height:.8rem;border-bottom:1px solid #e8e8e8;padding-left:.13rem;box-sizing:border-box;font-size:.28rem;color:#333;}
			.suggest_list>ul>li:last-child{border-bottom:none;}
			.mui-segmented-control{overflow: visible;}
			.suggest_list>ul>.sugg_active{color:#1653fc;background:url(../../images/work/choose-@2x.png) no-repeat;background-position:6.2rem center;background-size:.3rem auto;}
			.mui-fullscreen .mui-segmented-control~.mui-slider-groups{top:.9rem;}
			.bg_blue{background:#f8c96f;}
			.bg_blue01{background:#79c3f7;}
			.bg_green{background:#60e9e1;}
			.navigate_img{width:.43rem;height:.43rem;display:block;border-radius:.04rem;float:left;margin-right:.13rem;}
			.navigate_img>img{width:.25rem !important;margin:0.09rem 0 0 0.09rem;}
			.mui-table-view .mui-media-body{width:6.2rem;float:left;overflow:visible;}
			.mui-table-view .mui-media-body>div{width:100%;float:left;}
			.mui-table-view .mui-media-body .body_view{font-size:.28rem;}
			.mui-table-view .mui-media-body .body_view>span,.mui-table-view .mui-media-body .mui-ellipsis>span{float:left;width:5rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
			.mui-table-view .mui-media-body .work_time{color:#b0b0b0;font-size:.22rem;}
			.mui-table-view .mui-media-body .mui-ellipsis{color:#666;font-size:.22rem;}
			.mui-table-view-cells{padding:0;margin-bottom:.15rem;background:#fff;position:sticky;z-index: -10;}
			.mui-media-box{padding:.38rem 0 0 .38rem;float:left;}
			.mui-table-view .mui-media-right{float:right;width:1.1rem;position:relative;height:100%;}
			.mui-table-view .icon-more{width:.45rem;float:right;height:.45rem;position:relative;background:url(../../images/work/icon-gd-@2x.png) no-repeat;background-size:100% 100%;}
			.mui-table-view .icon-more>img{margin-top:-.03rem;}
			.mui-table-view-cells>a:not(.mui-btn){margin:0;padding:0;}
			.mui-table-view .zhuangtai{width:1.2rem;float:left;text-align:right;font-size:.26rem;margin-top:-.07rem;}
			.mui-push-right:after{content:"";}
			.mui-table-view-cells:after{height:0;}
			.evaluate{width:100%;border-top:1px solid #ececec;height:.6rem;line-height:.6rem;font-size:.26rem;color:#666;text-align:center;margin-top:.3rem !important;float:left;}
			.mui-table-view{background:none;position:sticky;}
			.mui-sliders{position:absolute;height:100%;z-index:1;width:100%;}
			.mui-sliders .mui-slider-groups{position: absolute; top:0;bottom: 0;width: 100%;height: auto;}
			.mui-sliders .mui-slider-groups .mui-slider-item {position: relative;display: inline-block;width: 100%;
    height: 100%;vertical-align: top; white-space: normal;}
			/*弹层*/
			.more_message{width:7rem;top:.5rem;background:#fff;border-radius:.06rem;position:absolute;right:.25rem;z-index:5;border:1px solid #e2e2e2;display:none;}
			.more_message .more_message_box{position:relative;width:100%;float:left;padding:.35rem .38rem;box-sizing:border-box;}
			.more_message .more_message_box>i{width:.2rem;height:.2rem;position:absolute;top:-.15rem;right:.15rem;background:url(../../images/work/arrow_up.png) no-repeat;}
			.bg_gray{width:7.5rem;background:rgba(0,0,0,0.3);height:100%;position:fixed;top:-.9rem;z-index:3;right:0;}
			.mui-icon-trash{font-size:.4rem;color:#8c8c8c;float:left;margin-right:.05rem;}
			.message_info{font-size:.28rem;}
			.mui-popover {
				height: 140px;
			}
			.mui-pull{position: relative;margin-top: 15px;}
		</style>
	</head>

	<body>
		<div id="scroll" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll">
				<ul class="mui-table-view" id="mui-table-view" v-if="is_show">
					<li class="mui-table-view-cells mui-media" v-for="netCase in myNetCaseList">
							<div class="mui-media-box">
								<span :class="netCase.navigateImgColor">
								<img class="tjfwl" :src="netCase.serviceFwztSrc">
								</span>
								<div class="mui-media-body">
									<div class="body_view">
										<span>{{netCase.serviceName}}</span>
										<div class="icon-more" :data-guid="netCase.caseId" :caseSource = "netCase.caseSource" :blStatus ="netCase.blStatus" :id="netCase.caseId" :serviceId="netCase.serviceId"></div></div>
									<div class="work_time">{{netCase.applyTime}}</div>
									<div class='mui-ellipsis'>
										<span>办件编号: {{netCase.caseNum}}</span>
										<div :class="netCase.blStatusColor">{{netCase.blStatusVal}}</div>
									</div>
								</div>
							</div>
							<a class="evaluate" :zwfwCaseId="netCase.caseId">查看详情</a>
						</li>
				</ul>
			</div>
		</div>
		<!--弹层-->
		<div id="middlePopover" class="mui-popover">
			<div class="mui-popover-arrow"></div>
			<div class="mui-scroll-wrapper">
				<div class="mui-scroll">
					<ul class="mui-table-view" id="middlePopoverUl">
					</ul>
				</div>
			</div>
		</div>
		<script>
			function my_immersed(immersed){
			}
		</script>
		<script src="../../js/immersed.js"></script>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/jquery2.2.4.min.js"></script>
		<script src="../../js/common.js"></script>
		<script src="../../js/mui.pullToRefresh.js"></script>
		<script src="../../js/mui.pullToRefresh.material.js"></script>
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/app.js"></script>
		
		<script>
			var pageStart = 0;//当前页码
			var pageSize = 5;//每页显示的条数
			var maxPageNumber = 1;//最大页数
			
			mui.init({
				pullRefresh: {
					container: "#scroll", //下拉刷新容器标识，querySelector能定位的css选择器均可，比如：id、.class等
					  up: {//上拉加载
				            contentrefresh: '正在加载...',
				            auto:true,//可选,默认false.自动上拉加载一次
				            contentnomore:'没有更多数据了',//可选，请求完毕若没有更多数据时显示的提醒内容；
				            callback: pullupRefresh
				       }
				}
			});
		
			var news = new Vue({
				  el: '#mui-table-view',
				  data: {
				  	myNetCaseList:[],
				  	is_show:false
				  }
				  
			});
			
			//点击数据弹出操作按钮菜单
			mui('.mui-content').on('tap', '[data-guid]', function() {
				var id = this.getAttribute('id');
				var caseSource = this.getAttribute('caseSource');
				var blStatus = this.getAttribute('blStatus');
				var serviceId = this.getAttribute('serviceId');
				getIconMore(id,serviceId,caseSource,blStatus);
			});
			
			
			//查看办件详情
			mui('.mui-content').on('tap', '[zwfwCaseId]', function() {
				utils.showWaiting();
				var zwfwCaseId = this.getAttribute('zwfwCaseId');
				localStorage.setItem("zwfwCaseId",zwfwCaseId);
				showTemplates('../my/my_netCase_detail.html','办件详情','../my/my_netCase_detail.html');
			});

			
			/**
			 * 上拉加载页面数据
			 */
			function pullupRefresh() {
			    setTimeout(function() {
			        pageStart++;//翻下一页
			        if(pageStart<=maxPageNumber){
			       		loadMore(pageStart,pageSize);//具体取数据的方法
			        }else{
			        	mui('#scroll').pullRefresh().endPullupToRefresh(true);
			        }
			    }, 100);
			}
			
			function loadMore(pageStart,pageSize) {
			    var param = 'userId='+getUserId()+'&pageNumber=' + pageStart+ '&random=' + Math.random()+'&pageSize=' + pageSize;
				var url = 'appHttpService/getMyNetCaseList.do';
			    utils.ajax(url, function(data) {
					data = JSON.parse(data);
					if(data.state == 0) {
						if(data.maxPageNumber != undefined){
							maxPageNumber = data.maxPageNumber;
						}
						
						if(data.zwfwCaseVo != undefined){
							var rows = JSON.parse(data.zwfwCaseVo);
							if(rows != null && rows.length > 0){
								news.is_show = true;
								var caseStausTypeMap = JSON.parse(data.caseStausTypeMap);
								news.myNetCaseList = news.myNetCaseList.concat(convert(rows,caseStausTypeMap));
								if(data.total <pageSize){
									mui('#scroll').pullRefresh().endPullupToRefresh(true);
								}else{
									mui('#scroll').pullRefresh().endPullupToRefresh(false);
								}
							}else{
								mui('#scroll').pullRefresh().endPullupToRefresh(true);
							}
						}else{
							mui('#scroll').pullRefresh().endPullupToRefresh(true);
						}
					}else{
							mui('#scroll').pullRefresh().endPullupToRefresh(true);
						}
				}, param);
				
			};
			
			/**
			 * 1、将服务端返回数据，转换成前端需要的格式
			 * 2、若服务端返回格式和前端所需格式相同，则不需要改功能
			 * 
			 * @param {Array} items 
			 */
			function convert(items,caseStausTypeMap) {
				var newItems = [];
				items.forEach(function(item) {
					newItems.push({
						serviceName: item.serviceName,
						serviceId: item.serviceId,
						serviceFwztSrc:getServiceFwztSrc(item.subjectClassificationCode),
						caseSource: item.caseSource,
						blStatusVal: getStaticParas(caseStausTypeMap,item.blStatus),
						blStatus: item.blStatus,
						blStatusColor:getColor(item.blStatus),
						caseId: item.caseId,
						applyTime:item.applyTime,
						caseNum: getHandleAttribute(item.caseNum),
						navigateImgColor:getNavigateImgColor(item.blStatus)
					});
				});
				return newItems;
			}
			
			/**
			 * 获取服务事项的服务主题显示
			 */
			function getServiceFwztSrc(subjectClassificationCode){
				var src = "../../images/index/tjfw1-@2x.png";
				/*if(subjectClassificationCode != null && subjectClassificationCode != '' && subjectClassificationCode != undefined){
					src = '';
				}*/
				return src;
			}
			
			/**
			 * 处理字段
			 * @param {Object} attribute 字段属性
			 */
			function getHandleAttribute(attribute){
				var newAttribute = attribute;
				if(newAttribute == '' || newAttribute == undefined || newAttribute == null){
					newAttribute = '';
				}
				return newAttribute;
			}
			
			//通过值查找出静态变量中对应的文字
			function getStaticParas(caseStausTypeMap,blStatus){
				var val = "";  
				$.each(caseStausTypeMap, function(key, value) { 
					$.each(value, function(key, value) { 
						if(blStatus == key){
							 val = value;  
                			 return false;//用false结束循环  
						}
					}); 
				}); 
				return val;  
			}
			
			/**
			 * 加载数据后调用点击的方法
			 */
			function getIconMore(id,serviceId,caseSource,blStatus){
				loadMiddlePopoverUl(caseSource,blStatus,id,serviceId);//给弹出菜单添加按钮值
				mui('#middlePopover').popover('toggle',document.getElementById(id));
			}
			
			/**
			 * 获取办理状态的颜色显示 修改此方法的判断的同时也要修改getNavigateImgColor方法
			 */
			function getColor(blStatus){
				var color = "zhuangtai";
				if(blStatus == 0 || blStatus == 5){ //"0":"暂存","5":"补齐补正"
					color = "zhuangtai orange";
				}else if(blStatus == 7 || blStatus == 4 || blStatus == 8 ){ //"7":"不予受理","4":"不通过","8":"撤销申请" 颜色不设置
				
				}else{
					color = "zhuangtai blue";
				}
				return color;
			}
			
			/**
			 * 获取办件主题图片的背景色 注意跟getColor方法保持一致
			 */
			function getNavigateImgColor(blStatus){
				var color = "navigate_img bg_green";
				if(blStatus == 0 || blStatus == 5){ //"0":"暂存","5":"补齐补正"
					color = "navigate_img bg_blue";
				}else if(blStatus == 7 || blStatus == 4 || blStatus == 8 ){ //"7":"不予受理","4":"不通过","8":"撤销申请" 颜色不设置
				
				}else{
					color = "navigate_img bg_blue01";
				}
				return color;
			}
			
			
			/**加载弹出菜单中的参数值
			 * @param {Object} caseSource 办件来源   caseSource等于1时表示数据来源为网上申请
			 * @param {Object} blStatus 办件状态     blStatus的参数值为   ("3":"已办结","2":"办理中","1":"已申报","0":"暂存","7":"不予受理","6":"预审通过","5":"补齐补正","4":"不通过","8":"撤销申请")
			 */
			function loadMiddlePopoverUl(caseSource,blStatus,caseId,serviceId){
				var caseStausZC = 0;//暂存
				var caseStausSubmit = 1;//已申报
				var caseStausAccepted = 2;//办理中
				var caseStausPass = 3;//已办结
				var caseStausNotPass = 4;//不通过
				var caseStausBQBZ = 5;//补齐补正
				var caseStausRevoke = 8;//撤销申报
				var caseStausYsPass = 6;//预审通过
				var caseStausNotAccept = 7; //不予受理
				document.getElementById("middlePopoverUl").setAttribute("caseId",caseId);
				document.getElementById("middlePopoverUl").setAttribute("serviceId",serviceId);	
				if(caseSource == 1){ //dataObj.caseSource等于1时表示数据来源为网上申请
					var fragment = document.createDocumentFragment();
					if(blStatus == caseStausZC){
						//设置弹出菜单的高度，若高度太低内容太多的话 会遮挡住箭头
						document.getElementById("middlePopover").style.height = 45*4 + "px";
						for (var i = 0;i <4; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","cxsq");
								li.innerHTML = '<a href="#">撤销申请</a>';
							}else if(i == 1){
								li.setAttribute("aim","work/netCase/caseRegStep2.html");
								li.id = "netCase/caseRegStep2";
								li.innerHTML = '<a href="#">继续申请</a>';
							}else if(i == 2){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}else if(i == 3){
								li.setAttribute("aim","bjsc");
								li.innerHTML = '<a href="#">办件删除</a>';
							}
							fragment.appendChild(li);
						}
					}else if(blStatus == caseStausSubmit){
						document.getElementById("middlePopover").style.height = 45*1 + "px";
						for (var i = 0;i < 1; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}
					}else if(blStatus == caseStausAccepted || blStatus == caseStausYsPass){
						document.getElementById("middlePopover").style.height = 45*1 + "px";
						for (var i = 0;i < 1; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}

					}else if(blStatus == caseStausPass){
						document.getElementById("middlePopover").style.height = 45*2 + "px";
						for (var i = 0;i < 2; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","bjpj");
								li.innerHTML = '<a href="#">办件评价</a>';
							}else if(i == 1){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}
					}else if(blStatus == caseStausNotPass || blStatus == caseStausNotAccept || blStatus == caseStausRevoke){
						document.getElementById("middlePopover").style.height = 45*3 + "px";
						for (var i = 0;i < 3; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","bjpj");
								li.innerHTML = '<a href="#">办件评价</a>';
							}else if(i == 1){
								li.setAttribute("aim","work/netCase/caseRegStep2.html");
								li.id = "netCase/caseRegStep2";
								li.innerHTML = '<a href="#">重新申请</a>';
							}else if(i == 2){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}
					}else if(blStatus == caseStausBQBZ){
						document.getElementById("middlePopover").style.height = 45*2 + "px";
						for (var i = 0;i < 2; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","bqbz");
								li.innerHTML = '<a href="#">补齐补正</a>';
							}else if(i == 1){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}
					}
					jQuery('#middlePopoverUl').html("");
					document.getElementById("middlePopoverUl").appendChild(fragment);
				}else{
					var fragment = document.createDocumentFragment();
					if(blStatus == caseStausSubmit){
						document.getElementById("middlePopover").style.height = 45*1 + "px";
						for (var i = 0;i < 1; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}
					}else if(blStatus == caseStausAccepted || blStatus == caseStausYsPass ){
						document.getElementById("middlePopover").style.height = 45*1 + "px";
						for (var i = 0;i < 1; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}

					}else if(blStatus == caseStausPass){
						document.getElementById("middlePopover").style.height = 45*2 + "px";
						for (var i = 0;i < 2; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","bjpj");
								li.innerHTML = '<a href="#">办件评价</a>';
							}else if(i == 1){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}
					}else if(blStatus == caseStausNotPass || blStatus == caseStausNotAccept){
						document.getElementById("middlePopover").style.height = 45*2 + "px";
						for (var i = 0;i < 2; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","bjpj");
								li.innerHTML = '<a href="#">办件评价</a>';
							}else if(i == 1){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a  href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}

					}else if(blStatus == caseStausBQBZ){
						document.getElementById("middlePopover").style.height = 45*1 + "px";
						for (var i = 0;i < 1; i++) {
							var li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							if(i == 0){
								li.setAttribute("aim","suqiu/initAppeal.html");
								li.innerHTML = '<a  href="#">办件投诉</a>';
							}
							fragment.appendChild(li);
						}
					}
					jQuery('#middlePopoverUl').html("");
					document.getElementById("middlePopoverUl").appendChild(fragment);
				}
			}
			//具体按钮操作
			mui("#middlePopoverUl").on("tap","li",function(){
				var caseId = $("#middlePopoverUl").attr('caseId');
				var serviceId = $("#middlePopoverUl").attr('serviceId');
				var aim = $(this).attr('aim');
				var id =  this.id;
				if(aim == "cxsq"){//撤销申报
					cxsq(caseId);
				}else if(aim == "bjsc"){//办件删除
					bjsc(caseId);
				}else if(aim == "bqbz"){
					bqbz(caseId,serviceId);
				}else if(aim == "bjpj"){
					if(caseId != null && caseId != undefined && caseId != ''){
						var param = 'caseId='+caseId;
						var url = 'appHttpService/valideNetCaseIsEvaluate.do';
						utils.ajax(url, function(data) {
							data = JSON.parse(data);
							if(data.state == 0) {					
								var evaluateFlag = data.evaluateFlag;	
								if(evaluateFlag != undefined && evaluateFlag == '1'){
									//该办件已经评价
									showTemplates('my_evaluate_detail.html','评价详情','_www/src/my/my_evaluate_detail.html?oid='+caseId);
								}else if(evaluateFlag != undefined && evaluateFlag == '0'){
									//该办件未评价
									openNewWin("_www/src/my/my_evaluate_case.html",null,'my_evaluate_case.html',{
									 	oid:caseId
									 })
								}
							}
						}, param);
					}
				}else{
					openNew("_www/src/"+aim,id?id:aim,{caseId:caseId,serviceId:serviceId,type:2},true,null,{hardwareAccelerated:true});
					mui('#middlePopover').popover('toggle',document.getElementById(caseId));
				}
			})
			/**
			 * 补齐补正
			 * @param {Object} caseId
			 */
			var bqbz = function(caseId,serviceId){
				var url = "appNetCase/appCheckCaseCorrection.do?";
				utils.ajax(url,function(data){
					mui('#middlePopover').popover('toggle',document.getElementById(caseId));
					data = JSON.parse(data);
					if(data.state == 1){
						/*var setp2view = openNew("_www/src/work/netCase/caseRegStep2.html","netCase/caseRegStep2",
											{
												caseId:caseId,serviceId:serviceId,
												caseCorrectionOid:data.caseCorrectionOid,
												correctionReason:data.correctionReason
											},
											true,null,{hardwareAccelerated:true});*/
											
						var setp2view = openNewWin("_www/src/work/netCase/caseRegStep2.html", null, 'netCase/caseRegStep2',{
							caseId:caseId,serviceId:serviceId,
							caseCorrectionOid:data.caseCorrectionOid,
							correctionReason:data.correctionReason
						})
						setp2view.show('zoom-fade-out');
						setp2view.addEventListener('close',function(){
							plus.webview.currentWebview().reload();
						})
					}else{
						mui.toast(data.msg?data.msg: "获取办件信息失败,请重试");
					}
				},"caseId="+caseId,{showWait:true})
			}
			/**
			 * 撤销申报
			 * @param {Object} caseId
			 */
			var cxsq = function(caseId){
				mui('#middlePopover').popover('toggle',document.getElementById(caseId));
				mui.prompt('确认要撤销办件么?',"请输入撤销原因",null,null,function(e){
					if(e.index == 1){
						if(!e.value){
							mui.toast("请填写撤销原因");
							return;
						}else{
							var url = "appNetCase/appRevokeNetCase.do";
							utils.ajax(url,function(data){
								data = JSON.parse(data);
								if(data.state == 1){
									mui.toast("撤销成功");
									plus.webview.currentWebview().reload();
								}else{
									mui.toast(data.msg? data.msg: "撤销失败请重试")
								}
							},jsonToParams({netCaseJson:JSON.stringify({oid:caseId,revokeReason:e.value})}),{showWait:true})
						}
					}
				},'div')
			}
			
			
			/**
			 * 办件删除
			 * @param {Object} caseId
			 */
			var bjsc = function(caseId){
				mui('#middlePopover').popover('toggle',document.getElementById(caseId));
				var btnArray = ['否', '是'];
                mui.confirm('确定要删除办件么？', '提示框', btnArray, function(e) {
                    if (e.index == 1) {
                        var url = "appNetCase/delAppNetCase.do";
							utils.ajax(url,function(data){
								data = JSON.parse(data);
								if(data.state == 1){
									mui.toast("删除成功");
									plus.webview.currentWebview().reload();
								}else{
									mui.toast(data.msg? data.msg: "删除失败请重试")
								}
							},{oid:caseId},{showWait:true})
                    } 
                })
			}
		</script>
	</body>

</html>